package com.service.impl;

import com.dao.MemberCostSetDao;
import com.dao.MemberCostlogDao;
import com.dao.MemberCosttotalDao;
import com.entity.TD_tblPartyMemberCostSet;
import com.entity.TD_tblPartyMemberCosttotal;
import com.entity.Td_tblPartyMemberCostlog;
import com.service.inte.MemberCostServiceInte;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class MemberCostImpl implements MemberCostServiceInte {

    @Autowired
    private MemberCostSetDao memberCostSetDao;

    @Autowired
    private MemberCosttotalDao memberCosttotalDao;

    @Autowired
    private MemberCostlogDao memberCostlogDao;

    @Override
    public TD_tblPartyMemberCostSet getByFd_LoginID(int loginId){
        return memberCostSetDao.getByFd_LoginID(loginId);
    }

    @Transactional
    @Override
    public void saveMemberCostSet(TD_tblPartyMemberCostSet td_tblPartyMemberCostSet){
        try {
            memberCostSetDao.save(td_tblPartyMemberCostSet);
        }catch (Exception ex){
            throw new RuntimeException("新建党费设置记录失败！");
        }
    }

    @Transactional
    @Override
    public void saveMemberCosttotal(TD_tblPartyMemberCosttotal td_tblPartyMemberCosttotal){
        try {
            memberCosttotalDao.save(td_tblPartyMemberCosttotal);
        }catch (Exception e){
            throw new RuntimeException("新建党费统计记录失败！");
        }
    }

    @Transactional
    @Override
    public void saveMemberCostLog(Td_tblPartyMemberCostlog td_tblPartyMemberCostlog){
        try {
            memberCostlogDao.save(td_tblPartyMemberCostlog);
        }catch (Exception e){
            throw new RuntimeException("新建党费日志记录失败");
        }
    }

}
